package cn.summit.captcha.config;

import cn.summit.captcha.service.CaptchaCodeCreator;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 图形验证码测试
 *
 * @author summit
 * @since 2020/12/1 16:34
 */
@Configuration
@EnableConfigurationProperties(CaptchaProperties.class)
public class CaptchaConfig {

    @Bean
    @ConditionalOnMissingBean(CaptchaCodeCreator.class)
    public CaptchaCodeCreator captchaCodeCreator(CaptchaProperties captchaProperties) {
        return new CaptchaCodeCreator(captchaProperties);
    }
}

